package homework2;

import homework.Employee;
import homework.Manager;
import homework.SE;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @classname:HashMapTest
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/14 20:31
 * @version: 0.1
 * @since:1.8
 */
public class HashMapTest {
    public static void main(String[] args) {
        Employee se = new SE("张三",23,2300);
        Employee se2 = new SE("王五",25,2300);
        Employee manger = new Manager("李四",26,2500,1000);
        Employee manger2 = new Manager("老大",24,2500,1000);
        HashMap<Integer,Employee> map = new HashMap<>();
        map.put(1,se);
        map.put(2,se2);
        map.put(3,manger);
        map.put(4,manger2);
        Set<Map.Entry<Integer, Employee>> entries = map.entrySet();
        Iterator<Map.Entry<Integer, Employee>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<Integer, Employee> entry = iterator.next();

            System.out.println(entry.getKey()+","+entry.getValue());
        }


    }
}
